package com.shandao.shangxiu.popup;


import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.inputmethodservice.KeyboardView;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.shandao.shangxiu.R;
import com.shandao.shangxiu.interf.PopupMenuClickListener;
import com.shandao.shangxiu.util.ToastUtils;


/**
 * 
 * 全局输入手机支付密码对话框
 *
 */
public class MyPopupBusinessCategory extends PopupWindow {

	private Context context;
	private TextView cancel;
	private GridView gridView;
	private PopupMenuClickListener listener;

	public MyPopupBusinessCategory(Context context){
		this.context=context;
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View conentView = inflater.inflate(R.layout.popup_business_category, null);
		iniView(conentView);
		this.setContentView(conentView);
		this.setWidth(LayoutParams.MATCH_PARENT);
		this.setHeight(LayoutParams.MATCH_PARENT);
		this.setFocusable(true);
		this.setTouchable(true);
		this.setOutsideTouchable(true);
		// 刷新状态
		this.update();
		// 实例化一个ColorDrawable颜色为半透明
		ColorDrawable dw = new ColorDrawable(0000000000);
		// 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ，设置其他控件变化等操作
		this.setBackgroundDrawable(dw);
	}

	private void iniView(View conentView) {
		gridView = (GridView) conentView.findViewById(R.id.grid);
		gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
				ToastUtils.show("onItemClick");
			}
		});
	}
}
